<!--{block return}-->
<script type="text/javascript" src="http://static.connect.renren.com/js/v1.0/FeatureLoader.jsp"></script>
<script type="text/javascript">
	function rr_login(){
		var style = document.createElement('link');
		style.href = 'source/plugin/renren/template/renren.css';
		style.rel = 'stylesheet';
		style.type = 'text/css';
		document.getElementsByTagName('HEAD').item(0).appendChild(style);
		hideWindow('login');
		hideWindow('register');
        if(XN&&XN.Connect)
	    {
		  XN.Connect.requireSession(function(){
		  setTimeout("showWindow('renren','plugin.php?id=renren:connect')",500);
		  });
		}

	}
	XN_RequireFeatures(["EXNML"], function() {
		XN.Main.init("{$_G['cache'][plugin][renren]['api_key']}", "{$_G['siteroot']}source/plugin/renren/xd_receiver/xd_receiver.html"<!--{if $_G['cache']['plugin']['renren']['rr_permfeed']}-->, {"permsToRequestOnConnect":"publish_feed"}<!--{/if}-->);
	});
</script>
<!--{if !$_G['uid'] && ( !isset($_G['gp_mod']) || !in_array($_G['gp_mod'], array('logging', 'register') ) ) && !$_G['cache']['plugin']['renren']['rr_index'] && $_G['gp_action']!='logout'}-->

<!--{elseif $isbind['bing'] && $_G['gp_action']!='logout'}-->
	<!--{if $_G['renren']}-->
<script type="text/javascript" language="javascript">
	function doClick(obj) {
		if(document.all) {
			obj.click();
		} else {
			var evt = document.createEvent("MouseEvents");
			evt.initEvent("click", true, true);
			obj.dispatchEvent(evt);
		}
	}
	function rr_logout(){
		var rrlogout = document.getElementById("rr_logout");
		rrlogout.onclick = '';
		doClick(rrlogout);
	}
	var node = document.getElementById("usersetup");
	if(node) {
		var insertedNode = document.createElement("span");
		insertedNode.innerHTML = '<a id="rr_logout" ><img style="padding-top:2px" width="14px" height="14px"    src="source/plugin/renren/template/image/rr.png" onerror="this.onerror=null;this.src=\'source/plugin/renren/template/image/rr.png\'" style="vertical-align:text-bottom" /></a>';
		node.parentNode.insertBefore(insertedNode, node.previousSibling);
	}
</script>
	<!--{else}-->
<script type="text/javascript" language="javascript">
	var node = document.getElementById("usersetup");
	if(node) {
		var insertedNode = document.createElement("span");
		insertedNode.innerHTML = '<a title="{lang renren:rr_login}" href="javascript:rr_login()"><img src="source/plugin/renren/template/image/rr_unlogin.png" onerror="this.onerror=null;this.src=\'source/plugin/renren/template/image/rr_unlogin.png\'" style="vertical-align:text-bottom" /></a>';
		node.parentNode.insertBefore(insertedNode, node.previousSibling);
	}
</script>
	<!--{/if}-->
<!--{else}-->
<!--{/if}-->
<!--{/block}-->